﻿import QtQuick 2.3
import QtQuick.Controls 1.2
import QmlObjectTest 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Private 1.0

ApplicationWindow {
    id: window
    visible: true
    width: Screen.width
    height: Screen.height
    title: qsTr("盖洛普Q12测评法")

    property var _ComboBoxIDS: [
        customLine1.comboxBox,
        customLine2.comboxBox,
        customLine3.comboxBox,
        customLine4.comboxBox,
        customLine5.comboxBox,
        customLine6.comboxBox,
        customLine7.comboxBox,
        customLine8.comboxBox,
        customLine9.comboxBox,
        customLine10.comboxBox,
        customLine11.comboxBox,
        customLine12.comboxBox,
    ]

    function submit(){
        var text = ""
        for(var i in _ComboBoxIDS){
            text += "问题" + String(Number(i)+1) + ": " + _ComboBoxIDS[i].currentText + "分\n"
        }
        text += "------------------------------------------------"
        messageDialog.informativeText = text
        messageDialog.visible = true
    }

    Column{
        width: parent.width
        height: parent.height
        y: 20
        spacing: 5

        CustomLine{
            id: customLine1
            textValue: "1．我知道公司对我的工作要求吗？"
        }
        CustomLine{
            id: customLine2
            textValue: "2．我有做好我的工作所需要的材料和设备吗？"
        }
        CustomLine{
            id: customLine3
            textValue: "3．在工作中，我每天都有机会做我最擅长做的事吗？"
        }
        CustomLine{
            id: customLine4
            textValue: "4．在过去的七天里，我因工作出色而受到表扬吗？"
        }
        CustomLine{
            id: customLine5
            textValue: "5．我觉得我的主管或同事关心我的个人情况吗？"
        }
        CustomLine{
            id: customLine6
            textValue: "6．工作单位有人鼓励我的发展吗？"
        }

        CustomLine{
            id: customLine7
            textValue: "7．在工作中，我觉得我的意见受到重视吗？"
        }
        CustomLine{
            id: customLine8
            textValue: "8．公司的使命目标使我觉得我的工作重要吗？"
        }
        CustomLine{
            id: customLine9
            textValue: "9．我的同事们致力于高质量的工作吗？"
        }
        CustomLine{
            id: customLine10
            textValue: "10．我在工作单位有一个最要好的朋友吗？"
        }
        CustomLine{
            id: customLine11
            textValue: "11．在过去的六个月内，工作单位有人和我谈及我的进步吗？"
        }
        CustomLine{
            id: customLine12
            textValue: "12．过去一年里，我在工作中有机会学习和成长吗？"
        }

        Row{
            anchors.right: parent.right
            spacing: 5
            Button{
                text: "取消"
                style: ButtonStyle{}
                onClicked: Qt.quit()
            }
            Button{
                text: "提交"
                style: ButtonStyle{}
                onClicked: {
                    submit()
                }
            }
        }
    }

    MessageDialog {
        id: messageDialog
        title: "评测结果"
        informativeText: ""
        icon: StandardIcon.Information
        standardButtons: StandardButton.Ok
        onAccepted: {
            console.log("end")
        }
        visible: false
    }

}

